<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>原生标签绑定事件</title>
		<script src="vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		
		<div id = "root">
			<!-- 在子组件标签中不能绑定原生标签的事件，必须都是自定义事件 -->
			<!-- 用.native装饰器可以用原生事件 -->
			<child @click.native = "handleClick"></child>
			
		</div>
		
	</body>
	
	<script type="text/javascript">
		
		Vue.component('child', {
			// 原生事件只能写在原生标签上
			template: '<div @click = "handleClick">Child</div>',
			methods:{
				handleClick: function(){
					console.log("接受到原生事件")
					// this.$emit("click");
				}
			}
		});
		var vm = new Vue({
			el: "#root",
			methods: {
				handleClick: function () {
					console.log("收到自定义事件");
				}
			}
		})
	</script>
</html>